const express = require('express')

const Topic = require('../models/topic')
const Model = Topic
const { log } = require('../utils')
const { currentUser, loginRequired } = require('./main')

// 使用 express.Router 可以创建模块化的路由
// 类似我们以前实现的形式
const api = express.Router()

api.get('/', (request, response) => {
    const ms = Model.all()
    log('debug ms', ms)
    const args = {
        topics: ms,
    }
    response.send( args)
})



module.exports = api

